﻿using System.Collections.Generic;
using System.Web.Mvc;
using ShopB2C.Entity;
using ShopB2C.Enums;
using System;
using ShopB2C.Parameters;

namespace ShopB2C.ViewModels {
    /// <summary>
    /// 商品搜索条件传递类
    /// </summary>
    public class ProductSearchCondition {
        /// <summary>
        /// 分类 id, 0 表示全部
        /// </summary>
        public int ClassifyId = 0;
        /// <summary>
        /// 分类特性值 id, "," 分隔(1,2,3)
        /// </summary>
        public string PropertyValIds = string.Empty;
        /// <summary>
        /// 商品搜索操作枚举（后台）
        /// </summary>
        public ProductSearchActionType Status = ProductSearchActionType.All;
        /// <summary>
        /// 只搜索商品名称, 搜索关键字
        /// </summary>
        public string Key = string.Empty;
        /// <summary>
        /// 排序字段
        /// </summary>
        public ProductSortFieldNames SortIndex = ProductSortFieldNames.SaleDateTime;
        /// <summary>
        /// 排序方向
        /// </summary>
        public SortDescriptions SortDescription = SortDescriptions.ASC;
        /// <summary>
        /// 登陆用户 id, 0 表示未登陆(获取折扣)
        /// </summary>
        public int UserId = 0;
        /// <summary>
        /// 每页显示记录数
        /// </summary>
        public int PageSize = 10;
        /// <summary>
        /// 当前页码
        /// </summary>
        public int PageIndex = 1;
        /// <summary>
        /// 商品状态, 默认显示正常状态的
        /// </summary>
        public ProductStatus ProductStatus = ProductStatus.Normal;
        /// <summary>
        /// 商品所属品牌, 默认全部
        /// </summary>
        public int BrandId = 0;
        /// <summary>
        /// 为 true 显示激活的商品, 为 false 显示未激活商品, 为 null 显示所有
        /// </summary>
        public bool? IsActive = null;
        /// <summary>
        /// 商品分类
        /// </summary>
        public string ModuleKey = "Product";
        /// <summary>
        /// 商品单价起始点
        /// </summary>
        public decimal PriceFrom = 0;
        /// <summary>
        /// 商品单价终止点
        /// </summary>
        public decimal PriceTo = 0;
        /// <summary>
        /// 商品显示方式
        /// </summary>
        public ProductShowType ShowType = ProductShowType.List;
    }
    /// <summary>
    /// 商品 ViewModel
    /// </summary>
    public class ProductViewModel {
        /// <summary>
        /// 当前的产品列表
        /// </summary>
        public List<ProductEntity> ProductList { get; set; }
        /// <summary>
        /// 产品预览
        /// </summary>
        public ProductEntity ProductView { get; set; }
        /// <summary>
        /// 图片列表
        /// </summary>
        public List<ProductImageEntity> ImageList { get; set; }
        /// <summary>
        /// 属性列表
        /// </summary>
        public List<ProductPropertyEntity> PropertyList { get; set; }
        /// <summary>
        /// 当前分类
        /// </summary>
        public ClassifyEntity Classify { get; set; }
        /// <summary>
        /// 产品图片根路径
        /// </summary>
        public string ImageRoot { get; set; }
        /// <summary>
        /// 产品详细说明
        /// </summary>
        public ProductDetailsEntity Details { get; set; }
        /// <summary>
        /// 会员折扣组
        /// </summary>
        public List<UserLevelEntity> MemberDiscount { get; set; }
        /// <summary>
        /// 所有产品分类
        /// </summary>
        public List<ClassifyEntity> ClassifyList { get; set; }
        /// <summary>
        /// 当前分类下的子分类或者他的父分类ID下的子分类(同辈分类)根据自己个人视情况指定
        /// </summary>
        public List<ClassifyEntity> ChildClassify { get; set; }
        /// <summary>
        /// 获取他的上级分类列表
        /// </summary>
        public ClassifyEntity ParentClassify { get; set; }
        /// <summary>
        /// 根据产品属性过滤
        /// </summary>
        public Dictionary<string, IEnumerable<ProductPropertyEntity>> PropertyFilter { get; set; }
        /// <summary>
        /// 商品批量操作枚举(ProductBatchActionType)填充 SelectList
        /// </summary>
        public SelectList BatchActionTypes { get; set; }
        /// <summary>
        /// 商品搜索操作枚举(ProductSearchActionType)填充 SelectList
        /// </summary>
        public SelectList SearchActionTypes { get; set; }
        /// <summary>
        /// 商品状态枚举(ProductStatus)填充 SelectList
        /// </summary>
        public SelectList ProductStatus { get; set; }
        /// <summary>
        /// 所有品牌集合
        /// </summary>
        public List<BrandEntity> BrandList { get; set; }
        /// <summary>
        /// 为 true 表示逐个修改, false 表示统一修改
        /// </summary>
        public bool IsOneByOne { get; set; }
        /// <summary>
        /// 分页实体
        /// </summary>
        public object Pager { get; set; }
        /// <summary>
        /// 页码
        /// </summary>
        public int PageNumber { get; set; }
        /// <summary>
        /// 记录总数
        /// </summary>
        public int RowsCount { get; set; }
        /// <summary>
        /// 商品展示参数
        /// </summary>
        public ProductParam ProductParams { get; set; }
        /// <summary>
        /// 排序 Url 集
        /// </summary>
        public Dictionary<string, string> SortDict { get; set; }
        /// <summary>
        /// 显示方式 Url 集
        /// </summary>
        public Dictionary<ProductShowType, string> ShowTypeDict { get; set; }
        /// <summary>
        /// 商品搜索
        /// </summary>
        public ProductSearchCondition Search { get; set; }
        /// <summary>
        /// 扩展属性列表
        /// </summary>
        public Dictionary<string , IEnumerable<ProductExtendEntity>> ExtendProperty { get; set; }
        /// <summary>
        /// 评论平均分
        /// </summary>
        public int CommentGVAvg { get; set; }
    }
}
